﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Wallpaper.Models.DTOs.Base
{
    public class TimeRangeQuery : QueryRequest
    {
        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime? StartTime { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime? EndTime { get; set; }

        /// <summary>
        /// 验证时间范围是否有效
        /// </summary>
        public bool IsValidTimeRange()
        {
            if (StartTime.HasValue && EndTime.HasValue)
            {
                return StartTime <= EndTime;
            }
            return true; // 如果有一个为空也算有效
        }
    }
}
